<!DOCTYPE html>
<html lang="zh-CN">

<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>AUTOTESIING</title>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="./webuploader/webuploader.css">
    <link href="./css/mycss.css" rel="stylesheet">
    <style>
       div.mycontainer{
           margin-top: 70px;
       }

        div.jumbotron {
            margin-top: 10px;
        }

        #svnuploader {
            margin-top: 30px;
        }

        /*#newStepDiv{*/
        /*margin-top:67px;*/
        /*}*/
        div.svnpath {
            padding-top: 3px;
        }

        div.vesion {
            margin-top: 10px;

        }

        #picker {
            height: 10px;
        }

        #ctlBtn {
            height: 40px;
        }

    </style>

    <script src="./js/jquery.js"></script>
    <script src="./js/bootstrap.min.js"></script>
    <script type="text/javascript" src="./webuploader/webuploader.min.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <!--<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">-->
            <!--<span class="sr-only">Toggle navigation</span>-->
            <!--<span class="icon-bar"></span>-->
            <!--<span class="icon-bar"></span>-->
            <!--<span class="icon-bar"></span>-->
            <!--</button>-->
            <a class="navbar-brand" href="#">LOGO</a>
        </div>
        <div class="navbar-collapse collapse ">
            <ul class="nav navbar-nav ">
                <li><a href="#">首页</a></li>
                <li class="active"><a href="#">构建测试</a></li>
                <li><a href="#autotest">自动化测试</a></li>
                <li><a href="#historyreport">历史报告</a></li>
            </ul>
            <ul class="nav navbar-nav pull-right">
                <li class=""><a href="#">登录</a></li>
                <li class=""><a href="#">注册</a></li>
            </ul>
        </div><!--/.nav-collapse -->
    </div>
</nav>
<!--end naving-->

<!--content starting-->
<div class="container mycontainer" role="main">
    <div class="jumbotron  ">
        <h1>构建测试</h1>
        <p>
            代码构建测试支持对Android客户端Ant/Maven/Gradle架构代码的构建和扫描，包括项目编译、JUnit单元测试、Findbugs、Checkstyle和PMD代码规范检查。
        </p>
    </div>
    <!--363-->
    <div class="Step-div" id="newStepDiv">
        <ul>
            <li id="newStepTwo" class="oneStep Step-Current" style="width: 338px; display: inline-block;">
                <span class="step-num">1</span>
                构建测试
                <span class="step-arrow-right"></span>
            </li>
            <li id="newStepThree" class="oneStep Step-Unreach" style="width: 338px; display: inline-block;">
                <span class="step-arrow-left"></span>
                <span class="step-num">2</span>
                测试处理中
                <span class="step-arrow-right"></span>
            </li>
            <li id="newStepFour" class="oneStep Step-Unreach"
                style="margin-right: 0px; width: 338px; display: inline-block;">
                <span class="step-arrow-left"></span>
                <span class="step-num">3</span>
                测试结果
            </li>
        </ul>
    </div>


    <div class="jumbotron " style="background-color: #e5e5e5">
        <div id="uploader" class="row">
            <!--用来存放文件信息-->
            <div class=" btns">
                <div class="radio col-md-2">
                    <label>
                        <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>本地代码
                    </label>
                </div>
                <div id="picker" class="col-md-2 ">选择文件</div>
                <div class="clo-md-2">
                    <button id="ctlBtn" class="btn btn-default ">开始上传</button>
                </div>
            </div>
            <div id="thelist" class="uploader-list"></div>
        </div>

        <div class="row" id="svnuploader">
            <div class="radio col-md-2 ">
                <label>
                    <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
                    SVN版本
                </label>
            </div>
            <div class="col-md-3 svnpath" id="svnPahinput">
                <input type="svnpath" class="form-control  svn-path" placeholder="Enter svnPath">
            </div>
            <div class="col-md-1  vesion">
                版本号
            </div>
            <div class="col-md-3 svnpath" id="svnvesrion">
                <input type="svnpath" class="form-control svn-version" placeholder="svn version">
            </div>
        </div>
    </div>
    <button type="button" class="btn btn-lg btn-primary testing center-block">开始测试</button>

</div>

<script>
    // 文件上传
    jQuery(function() {
        var $ = jQuery,
                $list = $('#thelist'),
                $btn = $('#ctlBtn'),
                state = 'pending',
                uploader;

        uploader = WebUploader.create({

            // 不压缩image
            resize: false,

            // swf文件路径
//            swf: BASE_URL + '/js/Uploader.swf',

            // 文件接收服务端。
            server: 'api/file/management?action=uploadfile&amp;encode=utf-8',

            // 选择文件的按钮。可选。
            // 内部根据当前运行是创建，可能是input元素，也可能是flash.
            pick: '#picker'
        });

        // 当有文件添加进来的时候
        uploader.on( 'fileQueued', function( file ) {
            $list.append( '<div id="' + file.id + '" class="item">' +
                    '<h5 class="info" style="padding-left: 200px">' + file.name +'<label id="cancel">&nbsp;取消上传</label>'+'</h5>'+
                    '<h5 class="state" style="color:#4D90FE;padding-left: 200px">等待上传...</h5>'  +
                    '</div>' );
        });


//        // 当有文件添加进来的时候
//        uploader.on( 'fileQueued', function( file ) {
//            $list.append( '<div id="' + file.id + '" class="item">' +
//                    '<h4 class="info">' + file.name + '</h4>' +
//                    '<p class="state">等待上传...</p>' +
//                    '</div>' );
//        });

        // 文件上传过程中创建进度条实时显示。
        uploader.on( 'uploadProgress', function( file, percentage ) {
            var $li = $( '#'+file.id ),
                    $percent = $li.find('.progress .progress-bar');

            // 避免重复创建
            if ( !$percent.length ) {
                $percent = $('<div class="progress progress-striped active">' +
                        '<div class="progress-bar" role="progressbar" style="width: 0%">' +
                        '</div>' +
                        '</div>').appendTo( $li ).find('.progress-bar');
            }

            $li.find('p.state').text('上传中');

            $percent.css( 'width', percentage * 100 + '%' );
        });

        uploader.on( 'uploadSuccess', function( file ) {
            $( '#'+file.id ).find('p.state').text('已上传');
        });

        uploader.on( 'uploadError', function( file ) {
            $( '#'+file.id ).find('p.state').text('上传出错');
        });

        uploader.on( 'uploadComplete', function( file ) {
            $( '#'+file.id ).find('.progress').fadeOut();
        });

        uploader.on( 'all', function( type ) {
            if ( type === 'startUpload' ) {
                state = 'uploading';
            } else if ( type === 'stopUpload' ) {
                state = 'paused';
            } else if ( type === 'uploadFinished' ) {
                state = 'done';
            }

            if ( state === 'uploading' ) {
                $btn.text('暂停上传');
            } else {
                $btn.text('开始上传');
            }
        });

        $btn.on( 'click', function() {
            if ( state === 'uploading' ) {
                uploader.stop();
            } else {
                uploader.upload();
            }
        });
    });

</script>

</body>
</html>